package com.fauks.fdmvvm.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding

/**
 * <pre>
 *     author : slx
 *     time   : 2021/02/26
 *     desc   :
 * </pre>
 */
abstract class BaseActivity<VM : BaseViewModel, VBD : ViewDataBinding> : AppCompatActivity() {

    protected var mViewModel: VM? = null
    protected lateinit var binding: VBD

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = DataBindingUtil.setContentView(this, getContentViewId())
        // 绑定生命周期
        binding.lifecycleOwner = this
        createViewModel()
        initData()
    }

    // 处理业务逻辑
    abstract fun initData()

    abstract fun getContentViewId(): Int

    // 创建ViewModel
    private fun createViewModel() {

    }


}